<!-- Sofija Puric 6/08 -->
<?php
include_once dirname(__FILE__) . '/db.php';
$con=dbConnect("sib");
$sql_sort="SELECT * FROM event ORDER BY DateFrom ASC";
$result=mysql_query($sql_sort);
if (!$result) {
    echo ("<p>Error performing query: " . mysql_error() . " </p>");
    exit();
}

function change_format_date($date) {
    $new = explode('-',$date);
    $year = $new[0]; $month = $new[1]; $day = $new[2][0].$new[2][1];
    $d = $day.'.'.$month.'.'.$year;
    return $d;
}

echo '<div id="eventsfull">';
    while ( $row = mysql_fetch_array($result) ) {
        $date_from = change_format_date($row["DateFrom"]);
        $date_to = change_format_date($row["DateTo"]);
        echo '<div class="event">
		<div class="title">
                    <h2>' . $row["Name"] . '</h2>
                    <p>'.$row["Location"].', ','
                    '.$date_from.' - '.$date_to.' </p>
                </div>
		<img src="'.$row["Url"].'" alt="'.$row["Alt"].'"/>
		<p>' . $row["BriefDescription"] . '</p>
                <p>' . $row["FullDescription"] . '</p>
                <div class="links"><a href="'.$row["Link"].'" target = "blank">See more about this event</a></div>
                </div>';
   }
   echo '</div>';
mysql_close($con);
?>


